package actions.admintool;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.ResultPath;

import com.opensymphony.xwork2.ActionSupport;

import dao.BarRepository;
import domain.Bar;

@Namespace("/")
@ResultPath(value="/")
public class BarListAction extends ActionSupport {
	
	public static final long serialVersionUID = 1L;
	private BarRepository br = new BarRepository();
	
	@Action(value="", results={
			@Result(name="success",location="pages/admintool/bar_list.jsp")
	})
	public String execute() {
		return SUCCESS;
	}
	
	public List<Bar> getBars() {		
		return br.getAllObjects();
	}
}
